import java.util.Scanner;

public class Hotel {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("输入房间号:");
        String roomNumber = scanner.nextLine();
        System.out.println("输入房间价格:");
        double basePrice = scanner.nextDouble();
        scanner.nextLine(); // 读取并丢弃换行符
        Room room = new Room(roomNumber, basePrice);

        System.out.println("输入用户姓名:");
        String name = scanner.nextLine();
        System.out.println("选择用户类型 (1：普通, 2：VIP, 3：SVIP):");
        int userType = scanner.nextInt();
        scanner.nextLine();

        PriceCalculator strategy = choosePricingStrategy(userType);
        User user = new User(name, strategy);

        scanner.close();

        System.out.println("用户: " + user.getName());
        System.out.println("房间号: " + room.getRoomNumber());
        System.out.println("需要支付的费用: " + user.getCalculate(room) + "元");
    }
    private static PriceCalculator choosePricingStrategy(int userType) {
        switch (userType) {
            case 1:
                return new Normal();
            case 2:
                return new VIP();
            case 3:
                return new SVIP();
            default:
                throw new IllegalArgumentException("非法类型: " + userType);
        }
    }
}
